<template>
  <master :title="title">
    <listpage ref="listpage"></listpage>
  </master>
</template>
<script type="text/javascript">
(function (G) {
var _this = null;
G.vue({
  "usingComponents": {///引入组件
    "master": "/components/Master/Master",///母版组件
    "listpage": "/components/List/Page/Page",///通用列表组件
    "modal":"/components/Modal/Modal"
  },
  "enablePullDownRefresh": true
},G.modelList({
  	modelName:'dataset',
    title:'数据集',
    listPage(list,query){
      list.searchKey = 'id,name,pjectId,createTimeString'
      list.actions.copy = {
        name:'复制编号',
        async action(event){
          try{
            await navigator.clipboard.writeText(event.detail.id)
            G.toask('已复制')
          }catch(e){
            G.alert('请手动复制以下编号:<br/>' + event.detail.id)
          }
        }
      }
      list.actions.test = {
        name:'连接测试',
        action(event){
          let item = event.detail
          G.get('/v1/dataset?id=' + item.id,null,null,{ loading:true,timeout:10 * 60 * 1000 }).then(res => {
            if(!res.errorMsg) G.alert(`共获取到条${res.length}数据`)
          })
        }
      }
    },
    modeleditquery(edit,event,query){
      edit.models.id.type = 'input'
    }
  },{
    data:{
      
    },
    mounted:function(query){
      // _this = this
    }
  }));
})(Y)
</script>
<style scoped>
  
</style>